1
2
3
4 package joeq.ClassLib.sun13_linux;
5
6 import java.util.Collections;
7 import joeq.Class.PrimordialClassLoader;
8 import joeq.Class.jq_Class;
9 import joeq.ClassLib.ClassLibInterface;
10 import joeq.Runtime.ObjectTraverser;
11 import joeq.Runtime.SystemInterface;
12 import joeq.UTF.Utf8;
13 import jwutil.collections.AppendIterator;
14
15 /***
16 * Interface
17 *
18 * @author John Whaley <jwhaley@alum.mit.edu>
19 * @version $Id: Interface.java 1941 2004-09-30 03:37:06Z joewhaley $
20 */
21 public final class Interface extends joeq.ClassLib.Common.InterfaceImpl {
22
23 /*** Creates new Interface */
24 public Interface() {}
25
26 public java.util.Iterator getImplementationClassDescs(joeq.UTF.Utf8 desc) {
27 if (ClassLibInterface.USE_JOEQ_CLASSLIB && desc.toString().startsWith("Ljava/")) {
28 joeq.UTF.Utf8 u = joeq.UTF.Utf8.get("Ljoeq/ClassLib/sun13_linux/"+desc.toString().substring(1));
29 return new AppendIterator(super.getImplementationClassDescs(desc),
30 Collections.singleton(u).iterator());
31 }
32 return super.getImplementationClassDescs(desc);
33 }
34
35 public ObjectTraverser getObjectTraverser() {
36 return sun13_linuxObjectTraverser.INSTANCE;
37 }
38
39 public static class sun13_linuxObjectTraverser extends CommonObjectTraverser {
40 public static sun13_linuxObjectTraverser INSTANCE = new sun13_linuxObjectTraverser();
41 protected sun13_linuxObjectTraverser() {}
42 public java.lang.Object mapInstanceField(java.lang.Object o, joeq.Class.jq_InstanceField f) {
43 if (IGNORE_THREAD_LOCALS) {
44 jq_Class c = f.getDeclaringClass();
45 if (c == PrimordialClassLoader.getJavaLangThread()) {
46 String fieldName = f.getName().toString();
47 if (fieldName.equals("threadLocals") || fieldName.equals("inheritableThreadLocals")) {
48
49
50
51 if (f.getType().getDesc() == Utf8.get("Ljava/util/Map;")) {
52 return java.util.Collections.EMPTY_MAP;
53 } else if (f.getType().getDesc() == Utf8.get("Ljava/lang/ThreadLocal$ThreadLocalMap;")) {
54 return null;
55 } else {
56 SystemInterface.debugwriteln("Unknown type for field "+f);
57 return null;
58 }
59 }
60 }
61 }
62 return super.mapInstanceField(o, f);
63 }
64 }
65 }